package com.kgc.easyshopping.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.kgc.easyshopping.dao.NewsMapper;
import com.kgc.easyshopping.entity.News;
import com.kgc.easyshopping.service.NewsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class NewsServiceImpl implements NewsService {
    @Resource
   private NewsMapper newsMapper;

    @Override
    public PageInfo<News> selectPageInfo(Map<String, Object> params) {
        int pageNum = (int) params.get("pageNum");
        int pageSize = (int) params.get("pageSize");
        PageHelper.startPage(pageNum,pageSize);
        List<News> news = newsMapper.selectPages(params);
        return new PageInfo<News>(news);
    }
}
